package com.ch.recycleviewdinddemo

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.LinearLayoutManager
import com.ch.recycleviewdinddemo.databinding.ActivityMainBinding

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val activityMainBinding: ActivityMainBinding =
            DataBindingUtil.setContentView(this, R.layout.activity_main)
        activityMainBinding.recycleView.layoutManager = LinearLayoutManager(this)
        val dataList = ArrayList<Idol>()
        for (i in 0 until 30) {
            val idol = Idol("chenhu_$i", "$i")
            dataList.add(idol)
        }
        val adapter = MyAdapter(dataList)
        activityMainBinding.recycleView.adapter = adapter
    }
}